import { reactive,onMounted,onBeforeUnmount} from 'vue'
export default function(){
    let point = reactive({
        x: 0,
        y: 0,
    })

    function savePoint(event){
        point.x = event.pageX// js 获取X轴坐标赋值给x变量
        point.y = event.pageY// js 获取Y轴坐标赋值给y变量
        console.log(event.pageX,event.pageY)
    }
    onMounted(()=>{
        window.addEventListener('click',savePoint)
    })
    onBeforeUnmount(()=>{
        window.removeEventListener('click',savePoint)
    })

    return point //js-导出的关键
}